package com.sunnay.exception;


import com.sunnay.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(DataException.class)
    public R businessExceptionHandler(DataException e){
        return R.fail(e.getCode(),e.getMessage());
    }
}
